home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / web_dev / files / mwjpp516.exe / %MAINDIR% / Tools / Code folding / foldAllChildren.script < prev    next >
Encoding:
Text File  |  2001-06-19  |  698 b   |  33 lines

  1. !!Script
  2. // Copyright ⌐ 1997-1998 - Modelworks Software
  3.  
  4. /**
  5. @Tool: foldAllChildren~closes all child lines of a parent line. 
  6. @EndTool: 
  7. @Summary: foldAllChildren~closes all child lines
  8. */
  9.  
  10. //
  11. // Fold all children of the selected parent
  12. //
  13.  
  14. function DoCommand()
  15. {
  16.   var editor = getActiveEditor();
  17.   if (editor)
  18.   {
  19.     var lines = editor.getLines();
  20.     var selection = editor.GetSelection();
  21.     var childIndex = lines.getFirstChildLineIndex(selection.startLineIndex); 
  22.     while (childIndex != -1)
  23.     {
  24.       lines.foldLine(childIndex);
  25.       childIndex = lines.getNextSiblingLineIndex(childIndex);
  26.     }
  27.     lines.update("Fold All Children");
  28.   }
  29. }
  30.  
  31. !!/Script
  32.  
  33.